import React from 'react'
import {
  StyleSheet,
  Image
} from 'react-native'
import {
  StackNavigator
} from 'react-navigation'

import * as publicParams from './public';
import Main from '../../pages/main'
//首页接口
//头部公共样式

const HomeTabs = StackNavigator({
  List: {
    screen: Main,
    navigationOptions: ({
      navigation
    }) => ({
      headerTitle: '首页',
      headerTitleStyle: {
        alignSelf: 'center',
        fontSize: 16
      }
    })
  },
  Detail: {
    screen: publicParams.DetailScreen,
    navigationOptions: ({
      navigation
    }) => ({
      title: `${navigation.state.params.name}详情页`,
      headerStyle: styles.headerStyle,
      headerTintColor: '#fff',
      tabBarVisible: false,
      headerTitleStyle: {
        alignSelf: 'center',
        fontSize: 16,
      }
    })
  },
  Comment: {
    screen: publicParams.CommentScreen,
    navigationOptions: ({
      navigation
    }) => ({
      title: `${navigation.state.params.name}列表页`,
      headerStyle: headerStyle,
      headerTintColor: '#fff',
      tabBarVisible: false,
      headerTitleStyle: {
        alignSelf: 'center',
        fontSize: 16,
      }
    })
  },

})
HomeTabs.navigationOptions = {
  title: '首页',
  tabBarLabel: '首页',
  tabBarIcon: ({
    tintColor,
    focused
  }) => (
    <Image
    source={focused ? require('../../static/Image/bottombtn0102.png') : require('../../static/Image/bottombtn0101.png')}
    style={[styles.icon, {tintColor: tintColor}]}
    />
  ),
}
const styles = StyleSheet.create({
  icon: {
    width: 26,
    height: 26,
  },
  headerStyle: {
    height: 52,
    paddingTop: 14,
    backgroundColor: '#e62e4c',
  }
});
export default HomeTabs;